home *** CD-ROM | disk | FTP | other *** search
- Path: news.iag.net!news
- From: jatmon@iag.net (John R Buchan)
- Newsgroups: comp.lang.c
- Subject: Re: Problem with sscanf on DEC Alpha
- Date: 11 Jan 1996 23:00:42 GMT
- Organization: Internet Access Group, Orlando, Florida
- Message-ID: <4d44qq$j32@news.iag.net>
- References: <4d3f0c$mfq@colossus.holonet.net>
- NNTP-Posting-Host: pm2-orl27.iag.net
- X-Newsreader: WinVN 0.99.7
-
- In article <4d3f0c$mfq@colossus.holonet.net>, mitch@news.mdli.com says...
- >
- >I'm having a problem with a line in my program:
- >
- > sscanf( sInputLine, "%3d%3d%10.4f%10.4f", &iAtom1,
- > &iAtom2, &(F3D->r3DV1), &(F3D->r3DV2) );
- >
- >F3D is a pointer to struct and the struct has double members
- >r3DV1 and r3DV2.
-
- I'm assuming that you mean something like:
-
- struct
- {
- double r3DV1, r3DV2;
- } *F3D;
-
- Your problem is that you are telling scanf to read and store a float,
- then passing the address of a double. Try:
-
- sscanf( sInputLine, "%3d%3d%10.4lf%10.4lf", &iAtom1,
- &iAtom2, &(F3D->r3DV1), &(F3D->r3DV2) );
-
- The 'l' (lower case 'L') tells scanf to read and store a double. A 'L'
- would indicate a long double.
-
- The c.l.c faq (Frequently Asked Question) list explains (Q12.13)this and many
- other common questions. It ia available for anonymous ftp from rtfm.mit.edu
- /pub/usenet/comp.lang.c.
-
- --
- John R Buchan -:|:- Looking for that elusive FAQ? ftp to:
- jatmon@mail.iag.net -:|:- rtfm.mit.edu /pub/usenet-by-group/....
-
-